package cn.gcxy.dao.impl;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import cn.gcxy.dao.BaseDAO;

public class pswDAO extends BaseDAO{
	public static PreparedStatement pstmt=null;
	public static boolean checkowner(String name,String password) 
	{
		String psw="";
		ResultSet rs=null;
		try {
			pstmt=conn.prepareStatement("SELECT * FROM petowner WHERE NAME=?");
			pstmt.setString(1, name);
			rs=pstmt.executeQuery();
			while(rs.next())
			{
				psw=rs.getString("PASSWORD");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(password.equalsIgnoreCase(psw))
			return true;
		else 
			return false;
	}
	public static boolean checkstore(String name,String password) 
	{
		String psw="";
		ResultSet rs=null;
		try {
			pstmt=conn.prepareStatement("SELECT * FROM petstore WHERE NAME=?");
			pstmt.setString(1, name);
			rs=pstmt.executeQuery();
			while(rs.next())
			{
				psw=rs.getString("PASSWORD");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if(password.equalsIgnoreCase(psw))
			return true;
		else 
			return false;
	}
}
